<style type="text/css">
    .flex{
        height: 40px;
    }
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">店铺名称:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-shop_name" class="form-control" data-rule="required" name="row[shop_name]" type="text" value="{$row.shop_name|htmlentities}" data-role="autocomplete" data-autocomplete-options='{"url":"shops/shop/autocomplete","onCache":true}'>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">平台选择:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-shop_type" data-rule="required" class="form-control selectpicker" name="row[shop_type]">
                {foreach name="shopTypeList" item="vo"}
                    <option value="{$key}" {if $key==$row.shop_type}selected{/if}>{$vo}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">店铺区域:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <input id="c-city" class="form-control" data-rule="required" placeholder="请选择省/市" data-responsive="true" data-level="district"  data-toggle="city-picker" name="row[shop_area]" type="text" value="{$row.shop_area|htmlentities}" />

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-address1" class="form-control" name="row[address]" type="text" value="{$row.address|htmlentities}" data-rule="required">
            <input id="c-address" class="form-control" type="hidden" value="{$row.address|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">纬度:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-lat" class="form-control" step="0.000001" name="row[lat]" type="number" value="{$row.lat|htmlentities}" data-rule="required">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Lng')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-lng" class="form-control" step="0.000001" name="row[lng]" type="number" value="{$row.lng|htmlentities}" data-rule="required">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">位置信息:</label>
        <div class="col-xs-12 col-sm-8">
            <button type="button" data-toggle="addresspicker" data-lat-id="c-lat" data-lng-id="c-lng" data-input-id="c-address" class="btn btn-primary" ><i class="fa fa-list"></i> 选择</button>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">商家号码:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-phone" class="form-control" name="row[phone]" type="text" value="{$row.phone|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Logo')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-logo_pic" data-rule="required" class="form-control" size="50" name="row[logo_pic]" type="text" value="{$row.logo_pic|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-logo_pic" class="btn btn-danger faupload" data-input-id="c-logo_pic" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-logo_pic"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-logo_pic" class="btn btn-primary fachoose" data-input-id="c-logo_pic" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-logo_pic"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-logo_pic"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">店铺二维码:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-qrcode_pic" class="form-control" size="50" name="row[qrcode_pic]" type="text" value="{$row.qrcode_pic|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-qrcode_pic" class="btn btn-danger faupload" data-input-id="c-qrcode_pic" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-qrcode_pic"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-qrcode_pic" class="btn btn-primary fachoose" data-input-id="c-qrcode_pic" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-qrcode_pic"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-qrcode_pic"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">业务员:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <select  id="c-salesman_admin_id" data-rule="required" class="form-control selectpicker" name="row[salesman_admin_id]" data-rule="required">
                <option value="">请选择</option>
                {foreach name="salesmanList" item="vo"}
                    <option value="{$vo.id}" {if $row.salesman_admin_id==$vo.id}selected{/if}>{$vo.nickname}</option>
                {/foreach}
            </select>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">经纪人（如有）:</label>
        <div class="col-xs-12 col-sm-8">
                        
            <!-- <select  id="c-middleman_id" class="form-control selectpicker" name="row[middleman_id]">
                <option value="">请选择</option>
                {foreach name="middleman" item="vo"}
                    <option value="{$vo.id}" {if $row.middleman_id==$vo.id}selected{/if}>{$vo.real_name}</option>
                {/foreach}
            </select> -->
            <input id="c-middleman_id" data-field="real_name" data-source="shops/middleman/index" class="form-control selectpage" name="row[middleman_id]" type="text" value="{$row.middleman_id|htmlentities}" data-search-field="real_name,id">

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">商家手续费:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-shop_settlement" class="form-control" name="row[shop_settlement]" type="text" value="{$row.shop_settlement|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">技术服务费:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-tech_service_amt" class="form-control" name="row[tech_service_amt]" type="text" value="{$row.tech_service_amt|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">配置项:</label>
        <div class="col-xs-12 col-sm-10" id="back_money">
            <div class="flex" >
                <div class="col-xs-12 col-sm-2">
                    单数
                </div>
                <!-- <div class="col-xs-12 col-sm-5" style="text-align: center;">
                    商家结算金额
                </div> -->
                <div class="col-xs-12 col-sm-5" style="text-align: center;">
                    用户返现金额
                </div>
            </div>
            <div class="flex" >
                <div class="col-xs-12 col-sm-2">
                    第1单:
                </div>
                <div class="col-xs-12 col-sm-5">
                    <input type="text" name="row[back_money][]" class="form-control back-money" value="{$row.back_money[1]}" data-index="1">
                </div>
            </div>
            <div class="flex" >
                <div class="col-xs-12 col-sm-2">
                    第2单:
                </div>
                <div class="col-xs-12 col-sm-5">
                    <input type="text" name="row[back_money][]" class="form-control back-money" value="{$row.back_money[2]}" data-index="2">
                </div>
            </div>
            <div class="flex" >
                <div class="col-xs-12 col-sm-2">
                    大于2单:
                </div>
                <div class="col-xs-12 col-sm-5">
                    <input type="text" name="row[back_money][]" class="form-control back-money" value="{$row.back_money[999999]}" data-index="3">
                </div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[shop_status]-{$key}"><input id="row[shop_status]-{$key}" name="row[shop_status]" type="radio" value="{$key}"  {if $row.shop_status==$key}checked{/if} /> {$vo}</label>
            {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script src="__CDN__/assets/libs/jquery/dist/jquery.min.js"></script>

<script type="text/javascript">
    function fill(e) {
        var val = parseFloat($(e).val())
        var index = parseInt($(e).attr('data-index'))-1
        var arr = [0.38,0.08,-0.32]
        var item = $('#back_money .back-money').eq(index)
        var res = val+arr[index]
        item.val(res.toFixed(2))
    }
</script>
